package org.lq.ssm.vo.mapper;

import org.lq.ssm.dto.UserDTO;
import org.lq.ssm.vo.LoginUserVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface LoginUserVOMapper {


    LoginUserVOMapper INSTANCE = Mappers.getMapper(LoginUserVOMapper.class);

    @Mappings({
            @Mapping(source = "token",target = "token"),
            @Mapping(source = "userDTO.avatarId",target = "avatar"),
            @Mapping(source = "userDTO.createTime",target = "createTime"),
            @Mapping(source = "userDTO.email",target = "email"),
            @Mapping(source = "userDTO.enabled",target = "enabled"),
            @Mapping(source = "userDTO.username",target = "username"),
            @Mapping(source = "userDTO.phone",target = "phone"),
            @Mapping(source = "jobName",target = "job"),
            @Mapping(source = "deptName",target = "dept"),
            @Mapping(source = "permissions",target = "roles"),
    })
    LoginUserVO userDTOTOLoginUserVO(UserDTO userDTO, String deptName, String jobName, List<String> permissions,String token);

    //List<LoginUserVO> loginUserVOTOLoginUserVOS(LoginUserVO loginUserVO);
}